//app.js
// 引入SDK核心类
var QQMapWX = require('/utils/qqmap-wx-jssdk.min.js')
require('./common/runtime.js')
require('./common/vendor.js')
require('./common/main.js')
App({
    globalData: {
        // ..其他全局变量..
        patrolForm: null,
        requestContext: 'https://www.kinnon.xyz/record', //请求路径上下文
        nickName: '',
        avatarUrl: '',
        punchDistance:2222275,


        // 实例化API核心类
        qqmapsdk: new QQMapWX({
            key: 'GTJBZ-FWXKD-SXO4W-H2VS5-2P5KS-M2FMZ' // 必填
        }),

        // ..其他全局变量..
    },
    checkLogin: function () {
        var that = this;
        var token = wx.getStorageSync("token")

        console.log("onload获取的token：" + token)
        
         wx.request({
            url: this.globalData.requestContext + '/cacheLogin',
            method: "post",
            header: {
                'content-type': "application/x-www-form-urlencoded", // 默认值
                'token': token
            },
            success: function (result) {
                if (result.data.code == 0) {
                   wx.switchTab({
                     url: '/pages/myself/myself',
                   })
                } else if(result.data.code == 1){
                    
                }
            }
        })
       
    },
    // checkLoginStatus: function () {
    //     let result =this.checkLogin()
    //     if (!result) {
    //         wx.reLaunch({
    //             url: '/pages/login/login',
    //         })
    //     }
    // }
    // 其他代码
})